Run Visual Studio with Administrator Rights using app.manifest [ExecutionLevel]
Posted
by srk
on Stack Overflow
See other posts from Stack Overflow
or by srk
Published on 2010-06-07T06:39:39Z
Indexed on
2010/06/07
6:52 UTC
Read the original article
Hit count: 267
c#
|visual-studio-2005
I need to change the key in a registry in order to restrict the user from using Task Manager, since it is an Kiosk application. My code for changing the registry is working perfectly for Administrator account. But my application is going to be run in normal user account. When i tried to run my application in normal user account, i get the below error :
DisableTaskManagerSystem.UnauthorizedAccessException:
Access to the registry key 'HKey_Current_User\Software\Mictrosoft\Windows\CurrentVersion\Policies\System' is denied.
at Microsoft.win32.RegistryKey.win32Error(int32 errorcode, String str)
So i need to run my application with all administrator privileges. For which i am using the below app.manifest. But some how i getting the same error. How to overcome this ?
Code in app.manifest :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft- com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="requireAdministrator" uiAccess="true">
</ms_asmv2:requestedExecutionLevel>
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>
</assembly>
© Stack Overflow or respective owner